package collection

/**
 * Created by Administrator on 2019/09/28.
 */
fun main(args: Array<String>) {
    val numbersMap = mapOf("key1" to 1, "key2" to 2, "key3" to 3, "key11" to 11)
    println(numbersMap.keys + numbersMap.values)
    println(numbersMap.get("key1"))
    println(numbersMap["key2"])
    println(numbersMap.getOrDefault("key4", 4))

    println(numbersMap.filter { (key, value) ->key.endsWith("1") && value > 10 })

    println(numbersMap.filterKeys { it.endsWith("1") })

    println(numbersMap.filterValues { it > 10 })

    println(numbersMap + Pair("key4", 4))

    println(numbersMap - "key1")

    val num2 = mutableMapOf("one" to 1, "two" to 2, "three" to 3)
    num2.putAll(listOf("four" to 4, "five" to 5))
    println(num2)

    println(num2.values.remove(5))
    println(num2)
}